`define data_width 34
module xbar(eastIn, southIn, westIn, northIn, hereIn,
           arbitEast, arbitSouth, arbitWest, arbitNorth, arbitHere,
                       eastOut, southOut, westOut, northOut, hereOut);

               input [`data_width:0] eastIn;
               input [`data_width:0] southIn;
               input [`data_width:0] westIn;
               input [`data_width:0] northIn;
               input [`data_width:0] hereIn;
               input [2:0] arbitEast;
               input [2:0] arbitSouth;
               input [2:0] arbitWest;
               input [2:0] arbitNorth;
               input [2:0] arbitHere;
               output [`data_width:0] eastOut;
               output [`data_width:0] southOut;
               output [`data_width:0] westOut;
               output [`data_width:0] northOut;
               output [`data_width:0] hereOut;


               assign eastOut = (arbitEast == 1) ? eastIn :
                                (arbitEast == 2) ? southIn :
                                                (arbitEast == 3) ? westIn :
                                                (arbitEast == 4) ? northIn :
                                                (arbitEast == 5) ? hereIn : 0;
               assign southOut = (arbitSouth == 1) ? eastIn :
                                 (arbitSouth == 2) ? southIn :
                                                 (arbitSouth == 3) ? westIn :
                                                 (arbitSouth == 4) ? northIn :
                                                 (arbitSouth == 5) ? hereIn : 0;
               assign westOut = (arbitWest == 1) ? eastIn :
                                 (arbitWest == 2) ? southIn :
                                                 (arbitWest == 3) ? westIn :
                                                 (arbitWest == 4) ? northIn :
                                                 (arbitWest == 5) ? hereIn : 0;
               assign northOut = (arbitNorth == 1) ? eastIn :
                                 (arbitNorth == 2) ? southIn :
                                                 (arbitNorth == 3) ? westIn :
                                                 (arbitNorth == 4) ? northIn :
                                                 (arbitNorth == 5) ? hereIn : 0;
       assign hereOut = (arbitHere == 1) ? eastIn :
                                 (arbitHere == 2) ? southIn :
                                                 (arbitHere == 3) ? westIn :
                                                 (arbitHere == 4) ? northIn :
                                                 (arbitHere == 5) ? hereIn : 0;

endmodule
